#基础镜像
FROM php:7.2-fpm

# 设置时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone

# 将本地源文件复制到镜像
ADD sources.list /etc/apt/sources.list

# 更新系统 && 安装依赖库
RUN apt-get update && apt-get install -y \
        libicu63=63.1-6  --allow-downgrades\
		libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
		zlib1g-dev \
		libicu-dev \
# 安装一些常用扩展
    && docker-php-ext-install -j$(nproc) iconv \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd \
    && docker-php-ext-install bcmath zip opcache iconv  pdo pdo_mysql mysqli intl

# apt-get安装扩展
RUN apt-get install -y libmcrypt-dev \
    && pecl install mcrypt-1.0.1  \
    && docker-php-ext-enable mcrypt

# pecl安装扩展
RUN pecl install redis-4.0.1 \
    && pecl install xdebug-2.6.0 swoole\
    && docker-php-ext-enable redis  swoole
	#不加载xdebug swoole和xdebug有冲突  xdebug
 
# composer 安装
RUN php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"
RUN mv composer.phar /usr/local/bin/composer	

#composer设置为阿里云镜像
RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/	

# supervisor 安装
RUN  apt-get install  -y supervisor
ADD  supervisord.conf /etc/supervisor/supervisord.conf

# 将本地php.ini复制到镜像中
ADD php.ini /usr/local/etc/php/php.ini

